Skip to content

Immutable selector return types#738

Open
elliottkember wants to merge 3 commits into
reduxjs:4.xfrom
elliottkember:elliott/737
Open

Immutable selector return types#738
elliottkember wants to merge 3 commits into
reduxjs:4.xfrom
elliottkember:elliott/737

Conversation

@elliottkember
Copy link
Copy Markdown

Addresses #737

@elliottkember
Copy link
Copy Markdown
Author

elliottkember commented Jan 16, 2025

The test:typescript tests were failing this PR, because of the way Readonly<Result> works. If the return type is null or any other type – readonly won't work and throws an error.

My solution here was to copy the Immutable definition from immer and use Immutable<Result> – which solves all the type errors. I don't know whether this is a desired approach (from a license or dependency standpoint) but it made the tests pass which is a good start.

@elliottkember elliottkember changed the title Selectors return shared mutable values Immutable selector return types Feb 22, 2025
@aryaemami59 aryaemami59 added the TypeScript Issues related to TypeScript. label Mar 18, 2026
@aryaemami59 aryaemami59 linked an issue Mar 18, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

TypeScript Issues related to TypeScript.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selectors return shared mutable values

2 participants